import 'package:flutter/material.dart';
import 'package:flutter_application_1/ui/widget/vertical_text.dart';

class MyPage extends StatefulWidget {
  final bool darkState;
  final void Function(bool newValue) changeBackTheme;
  const MyPage(
      {super.key, required this.darkState, required this.changeBackTheme});

  @override
  State<MyPage> createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> {
  void _handleTap() {
    widget.changeBackTheme(!widget.darkState);
  }

  double singleLineWidth = 16;
  int numberOfSingleLineText = 10;
  String from = "佚名";
  String textContent = "内容";
  bool darkModeOn = false;

  Widget textShow() {
    return VerticalText(
        textContent: textContent,
        from: from,
        numberOfSingleLineText: numberOfSingleLineText,
        singleLineWidth: singleLineWidth);
  }

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: _handleTap,
      child: Positioned(
          right: 20,
          top: 40,
          child: SizedBox(
            width: 30,
            height: 30,
            child: MaterialButton(
              padding: const EdgeInsets.all(0),
              child: Icon(
                  widget.darkState ? Icons.dark_mode_outlined : Icons.dark_mode,
                  size: 25),
              onPressed: () {
                widget.changeBackTheme(!widget.darkState);
              },
            ),
          )),
    );
  }
}
